proses Import image
library(EBImage)
Image <- readImage("D:/Rmarkdown/analisisEBimage/foto2.jpg")
print(Image)
## Image
## colorMode : Color
## storage.mode : double
## dim : 3092 1740 3
## frames.total : 3
## frames.render: 1
##
## imageData(object)[1:5,1:6,1]
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 0.007843137 0.011764706 0.02745098 0.019607843 0.03137255 0.05098039
## [2,] 0.023529412 0.019607843 0.00000000 0.015686275 0.02352941 0.07450980
## [3,] 0.003921569 0.007843137 0.00000000 0.007843137 0.01568627 0.07058824
## [4,] 0.000000000 0.000000000 0.00000000 0.000000000 0.00000000 0.05490196
## [5,] 0.011764706 0.027450980 0.02352941 0.007843137 0.00000000 0.03137255
display(Image)
menyesuaikan kecerahan
Image1 <- Image + 0.2
Image2 <- Image - 0.2
par(mfrow= c(1,2))
plot(Image1)
plot(Image2)
memanipulasi kontras
Image3 <- Image * 0.5
Image4 <- Image * 2
par(mfrow= c(1,2))
plot(Image3)
plot(Image4)
koreksi Gamma
Image5 <- Image ^ 2
Image6 <- Image ^ 0.7
par(mfrow= c(1,2))
plot(Image5)
plot(Image6)
#Cropping
display(Image[189:1000, 100:600,])
#Transformasi Spasial
Imagetr <- translate(rotate(Image, 45), c(50,0))
display(Imagetr)
#Manajemen warna
colorMode(Image) <- Grayscale
display(Image)
## Only the first frame of the image stack is displayed.
## To display all frames use 'all = TRUE'.
print(Image)
## Image
## colorMode : Grayscale
## storage.mode : double
## dim : 3092 1740 3
## frames.total : 3
## frames.render: 3
##
## imageData(object)[1:5,1:6,1]
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 0.007843137 0.011764706 0.02745098 0.019607843 0.03137255 0.05098039
## [2,] 0.023529412 0.019607843 0.00000000 0.015686275 0.02352941 0.07450980
## [3,] 0.003921569 0.007843137 0.00000000 0.007843137 0.01568627 0.07058824
## [4,] 0.000000000 0.000000000 0.00000000 0.000000000 0.00000000 0.05490196
## [5,] 0.011764706 0.027450980 0.02352941 0.007843137 0.00000000 0.03137255
colorMode(Image) <- Color
display(Image)
#low-pass filter
flow <- makeBrush(21, shape= 'disc', step=FALSE)^2
flow <- flow/sum(flow)
Image.flow <- filter2(Image, flow)
display(Image.flow)
#high-pass filter
fHigh <- matrix(1, nc=3, nr=3)
fHigh[2,2]<- -8
Image.fHigh <- filter2(Image, fHigh)
display(Image.fHigh)
daftar pustaka : https://thinkstudioo.blogspot.com/2018/03/analisis-image-menggunakan-ebimage-di-r_6.html